<!DOCTYPE html>
<%@ page import="domain.price.Price, svc.PriceSvc, constants.Constants, utils.Utility" %>
<%
	String userName="";
if(request.getSession().getAttribute("name")!=null){
	userName=request.getSession().getAttribute("name").toString();
}
if(!userName.equals("")) {
  String fileNo=(String)session.getAttribute("fileNo");
  double unit = (Double)session.getAttribute("unit");
  
  Price price = (Price) request.getAttribute("price");
  double[] heiferPrice = price.getP_heifer();
  double[] cullPrice = price.getP_bodyweight();
  double[] milkPrice = price.getP_milk();
  // out.print(fileNo);
%>
<html lang="en">
  <head>
    <title>Set Values</title>
    <meta name="viewport" content="widtd=device-widtd, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="autdor" content="">

    <!-- Le styles -->
    <link href="../css/bootstrap.css" rel="stylesheet">
    <link href="../css/bootstrap-responsive.css" rel="stylesheet">
     <link href="../css/docs.css" rel="stylesheet">
<link href="../css/google-code-prettify/prettify.css" rel="stylesheet">
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    
    
    
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
	  
	  
	
    </style>
   

    
   
  </head>

  <body>

    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
        <a class="brand" href="#">DairyVIP Project</a>
          <div class="nav-collapse collapse">
            <p class="navbar-text pull-right">
              Logged in as <a href="#" class="navbar-link"><%=userName%></a>
            </p>
            <ul class="nav">
             <li ><a href="../jsp/index.jsp">Home</a></li>
              <li><a href="../jsp/acknowledgements_contro.jsp">Acknowledgements/Contributors</a></li>
            <li><a href='../jsp/dataset.jsp'>My DairyVIP</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

    
    
    
   
   <div class="container">       
           <div class="pagination">
    <ul>
    <li><a href="../jsp/inputMisc">Misc</a></li>
    <li class="active"><a href="#">Price</a></li>
    <li><a href="../jsp/inputMilk" >Milk</a></li>
    <li><a href="../jsp/inputCull">Cull</a></li>
	<li><a href="../jsp/inputRepro">Repro</a></li>
    <li><a href="../jsp/inputBW">Bodyweight</a></li>
    </ul>
    </div>   
 </div>   
    
    
    <div class="container">
	<form id="savePrice" name="savePrice" method="post">
		<legend><small>PRICE AND DECISIONS   FOR year 2 and later (For year-1 values see tde manual)</small></legend><p></p>
		
		<p>
			<input class="btn" type="button" onclick="save(this.form)" value="Save" />
			<input class="btn" type="button" onclick="saveAnalyze(this.form)" value="Save and Analyze" />
		</p>
		<table cellspacing="0" cellpadding="1" style="background-color: #f5f5f5; border:#CCC solid 1px; font-size:12px " >
			<tr>
				<td colspan="13" align="center">
					<b>Seasonal prices</b>
				</td>
			</tr>
			<tr>
				<td style="border:#CCC solid 1px" ></td>
				
				<% for(int i=1; i<=12; i++) {%>
				<td align="center" style="border:#CCC solid 1px"><%= Constants.MONTHS[i] %></td>
				<% } %>
				
			</tr>
			<tr>
				<td style="border:#CCC solid 1px">
					<strong>Heifer Price($)</strong>
				</td>
				
				<% for(int i=1; i<=12; i++) {%>
				<td align="center" valign="middle" style="vertical-align:middle; border:#CCC solid 1px " >
					<input id ="heifer<%= i %>" name="heifer<%= i %>" value =<%= (String) Utility.roundToZero(heiferPrice[i]) %> type="text" style=" width:35px; height:15px; font-size:90% " size="5" class="span_1"/>
				</td>
				<% } %>
			</tr>
			
			<tr >
				<td style="border:#CCC solid 1px"  title="$0.42 per lbs live weight $0.80 per kg">
					<strong>Cull Price($)</strong>
				</td>
				
				<% for(int i=1; i<=12; i++) {%>
				<td align="center" valign="middle" style="vertical-align:middle; border:#CCC solid 1px"   >
					<input id = "cull<%= i %>" name="cull<%= i %>" value =<%= (String) Utility.roundUptoTwo(cullPrice[i]) %> type="text" style=" width:35px; height:15px; font-size:90%" size="5" class="span_1"/>
				</td>
				<% } %>
			</tr>
			
			<tr >
				<td style="border:#CCC solid 1px"  title="$17 per cwt (lbs) or $35 per cwt (kg)">
					<strong>Milk Price($/100kg)</strong>
				</td>
				
				<% for(int i=1; i<=12; i++) {%>
				<td align="center" valign="middle" style="vertical-align:middle; border:#CCC solid 1px"   >
					<input id = "milk<%= i %>" name="milk<%= i %>" value =<%= (String) Utility.roundToExactTwo(milkPrice[i]) %> type="text" style=" width:35px; height:15px; font-size:90%" size="5" class="span_1"/>
				</td>
				<% } %>
			</tr>
			<tr >
				<td colspan="13"  style="border:#CCC solid 1px"  >&nbsp;</td>
			</tr>
		</table>
		<p>&nbsp;</p>
	    
	</form>
</div>
	<script language="javascript">
		function save(form)/*function to check userid & password*/
		{
			form.action = '../jsp/savePrice';
			form.submit();
			return true;
		}
		function saveAnalyze(form)/*function to check userid & password*/
		{
			form.action = '../jsp/saveAnalyzePrice';
			form.submit();
			return true;
		}
	</script>
    
	<footer class="footer">
	 <%@ include file="../inc/footer.html" %>
	</footer>

 
	<script type="text/javascript" src="../js/jquery.js"></script>
	<script src="../js/bootstrap.js"></script>
 
<script>  
$(function ()  
{ $("#example1").popover({trigger: 'click',placement:'left'});  
  $("#example2").popover({trigger: 'click',placement:'bottom'});  

});   
</script>

  </body>
</html>
<%}else
out.print("Please <a href='../jsp/login.jsp'>log in</a> first!");
%>